home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 …SCII & the Runetime Code / ADC Developer CD (1992-07) (''Butch ASCII And The Runtime Code'')_iso / Dev.CD 199207.iso / Tools & Apps / OS⁄Toolbox / QuickDraw / ShowMonitorsƒ / ShowMonitors.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1990-09-14  |  3.4 KB  |  125 lines  |  [TEXT/TPAS]

  1. {[j=20-/40/80!,o=95,a-]}                    { PasMat formatting options }
  2.  
  3. {Cameron Birse, Macintosh Technical Support}
  4.  
  5. PROGRAM ShowMonitors;
  6.  
  7. {$U-}
  8.  
  9. USES
  10.         Memtypes,QuickDraw,OSIntf,ToolIntf,PackIntf,MacPrint,Script;
  11.  
  12.   
  13. TYPE
  14.     SysEnvRec      =       RECORD
  15.                 environsVersion:    INTEGER;
  16.                 machineType:           INTEGER;
  17.                 systemVersion:         INTEGER;
  18.                 processor:                INTEGER;
  19.                 hasFPU:                      BOOLEAN;
  20.                 hasColorQD:               BOOLEAN;
  21.                 keyBoardType:          INTEGER;
  22.                 atDrvrVersNum:         INTEGER;
  23.                 sysVRefNum:               INTEGER;
  24.                 END;
  25.  
  26.     SysEnvRecPtr = ^SysEnvRec;
  27.   RectArray = array [1..6] of rect;
  28.  
  29.     VAR
  30.         myStr        : Str255;
  31.         err            : Integer;
  32.         HPB            : HParamBlockRec; {Just use one parameter block for everything}
  33.         HPBPtr        : HParmBlkPtr; {Here's the pointer to it}
  34.   GDHdl : GDHandle;
  35.   getOut,doneflag : boolean;
  36.   MrIndex, HowMany, wRef : integer;
  37.   PackORects : RectArray;
  38.   wRecord : WindowRecord;
  39.   MyWindow : WindowPtr;
  40.   WRect,aRect : rect;
  41.   TheWorld : SysEnvRec;
  42.   EnvPtr : SysEnvRecPtr;
  43.   
  44. {------------------------------------------------------------------------------------}
  45.     
  46.      PROCEDURE Debugger; INLINE $A9FF;
  47.  
  48. {--------------------------------------------------------------------------------------------}
  49.  
  50.   FUNCTION SysEnvirons(versionRequested: INTEGER; VAR theWorld: SysEnvRec): OSErr;
  51.   
  52.   INLINE $205f,$301f, $A090, $3e80;
  53.  
  54. {------------------------------------------------------------------------------------}
  55.  Procedure DoInit;
  56.  { Do all toolbox and global variable initialization neccessary }
  57.  begin
  58.    initgraf(@thePort);
  59.    initFonts;
  60.    initWindows;
  61.    initMenus;
  62.    TEInit;
  63.    initDialogs(nil);
  64.    initcursor;
  65.    doneflag := false;
  66.    GetDateTime(RandSeed);
  67.  end; { procedure DoInit }
  68.  
  69.     {------------------------------------------------------------------------------------}
  70.  
  71.         BEGIN                              {main PROGRAM}
  72.  
  73.     DoInit;   {Init them Mgrs.}
  74.  
  75.     getOut := false;
  76.     
  77.     wRef := 1;
  78.     SetRect(WRect,40,40,450,300);        
  79.     MyWindow := NewWindow (@wRecord, WRect, 'Hey Now!', true, documentProc, WindowPtr(-1), true, wRef);
  80.     SetPort (MyWindow);    
  81.     err:= SysEnvirons (1,TheWorld);
  82.     if err = noerr then
  83.     begin
  84.         if theWorld.HasColorQD then
  85.         begin
  86.     
  87.             GDHdl := GetDeviceList;
  88.             PackORects[1] := GDHdl^^.gdRect;
  89.     
  90.             MrIndex := 2;
  91.             repeat
  92.                 begin
  93.                     GDHdl := GetNextDevice (GDHdl);
  94.                     if GDHdl <> nil then
  95.                     begin
  96.                         PackORects[MrIndex] := GDHdl^^.gdRect;
  97.                         MrIndex := MrIndex + 1;
  98.                     end
  99.                     else getout := true
  100.                 end;
  101.             until getout;
  102.     
  103.             HowMany := MrIndex - 1;
  104.        
  105.             For MrIndex := 1 to HowMany do
  106.             begin
  107.                 aRect.top := (160+PackORects[MrIndex].top div 10);
  108.                 aRect.left := (205+PackORects[MrIndex].left div 10);
  109.                 aRect.bottom := (160+PackORects[MrIndex].bottom div 10);
  110.                 aRect.right := (205+PackORects[MrIndex].right div 10);
  111.                 FrameRect (aRect);
  112.             end;
  113.     
  114.             repeat until button;
  115.     
  116.         end else begin
  117.                     MoveTo (20,20);
  118.                     DrawString ('This program only works on machines');
  119.                     MoveTo (20,40);
  120.                     DrawString ('equipped with color QuickDraw');
  121.                     repeat until button;
  122.                  end;
  123.     end;
  124.     CloseWindow (MyWindow);
  125. End.